public with sharing class MC_AlreadyContactedExtension
{
    public Missional_Community_Member__c Member {get; set;}
    
    public MC_AlreadyContactedExtension(ApexPages.StandardController controller)
    {
        Member=(Missional_Community_Member__c)controller.getRecord();
    }

    public PageReference Load()
    {
        Member.Has_Been_Contacted__c=true;
        update Member;
        return null;
    }
    
    public static testmethod void Test1()
    {
    	PageReference currentPage=Page.MC_AlreadyContacted;
    	Test.setCurrentPage(currentPage);
    	
    	Missional_Community__c aGroup=new Missional_Community__c();
    	Contact aLeader=new Contact();
    	aLeader.AccountId=[select id from Account where Name='Missional Community Members' limit 1].Id;
    	aLeader.FirstName='LeaderFirst';
    	aLeader.LastName='LeaderLast';
    	aLeader.Email='leader@email.bad';
    	insert aGroup;
    	insert aLeader;
    	Missional_Community_Member__c aGroupMember=new Missional_Community_Member__c();
    	aGroupMember.Contact__c=aLeader.Id;
    	aGroupMember.Missional_Community__c=aGroup.Id;
    	aGroupMember.Role__c='Leader';
    	aGroupMember.Has_Been_Contacted__c=false;
    	insert aGroupMember;
    	
    	ApexPages.StandardController controller=new ApexPages.StandardController(aGroupMember);
		MC_AlreadyContactedExtension extension=new MC_AlreadyContactedExtension(controller);
		extension.Load();
    	
    	
    	aGroupMember=[select Has_Been_Contacted__c from Missional_Community_Member__c where Id=:aGroupMember.id];
    	System.assertEquals(true, aGroupMember.Has_Been_Contacted__c);
    }
}